<template>
  <div class="city">
    <city-header></city-header>
    <city-search :cities="cities"></city-search>
    <city-list :hotCities="hotCities" :foreignCities="foreignCities" :cities="cities"></city-list>
  </div>
</template>
<script>
import axios from 'axios'
import CityHeader from './compontents/Header'
import CitySearch from './compontents/Search'
import CityList from './compontents/List'
import CityNavigation from './compontents/Navigation'
export default {
  name: "City",
  data() {
    return {
      hotCities: [],
      cities: {},
      foreignCities:{}
    }
  },
  components: {
    CityHeader,
    CitySearch,
    CityList,
    CityNavigation
  },
  methods: {
    getCityInfo() {
      axios.get('/api/city.json').then(res => {
        const data = res.data;
        if(data.ret){
          this.hotCities = data.data.hotCities
          this.cities = data.data.cities
          this.foreignCities = data.data.foreignCities
        }
      })
    }
  },
  created() {
    this.getCityInfo()
  }
}
</script>
<style lang="scss" scoped>
  .city{
    background-color: #f5f5f5;
  }
</style>
